<div class="fly-header layui-bg-black">
  <div class="layui-container">
    <a class="fly-logo" href="${pageContext.request.contextPath}/index">
      <img src="${pageContext.request.contextPath}/static/images/logo.png" alt="layui">
    </a>

    <ul class="layui-nav fly-nav-user">
      <c:choose>
        <c:when test="${empty user}">
          <!-- 未登入的状态 -->
          <li class="layui-nav-item">
            <a class="iconfont icon-touxiang layui-hide-xs"
               href="${pageContext.request.contextPath}/user/login"></a>
          </li>
          <li class="layui-nav-item">
            <a href="${pageContext.request.contextPath}/user/login">登入</a>
          </li>
          <li class="layui-nav-item">
            <a href="${pageContext.request.contextPath}/user/regist">注册</a>
          </li>
        </c:when>
        <c:otherwise>
          <!-- 登入后的状态 -->
          <li class="layui-nav-item">
            <a class="fly-nav-avatar" href="javascript:;">
              <cite class="layui-hide-xs">${user.getUname()}</cite>
              <c:if test="${user.getUauth() == 1}"><i
                      class="layui-badge fly-badge-vip layui-hide-xs">管理员</i></c:if>
              <img src="${pageContext.request.contextPath}/user/getpic?uid=${user.getUid()}">
            </a>
            <dl class="layui-nav-child">
              <dd><a href="${pageContext.request.contextPath}/user/set"><i class="layui-icon">&#xe620;</i>基本设置</a>
              </dd>
              <dd><a href="${pageContext.request.contextPath}/user/message"><i
                      class="iconfont icon-tongzhi" style="top: 4px;"></i>消息</a>
              </dd>
              <dd><a href="${pageContext.request.contextPath}/user/key"><i class="layui-icon">&#xe66e;</i>我的关注</a>
              </dd>
              <dd><a href="${pageContext.request.contextPath}/user/home"><i class="layui-icon"
                                                                            style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a>
              </dd>
              <hr style="margin: 5px 0;">
              <dd><a href="${pageContext.request.contextPath}/user/logout"
                     style="text-align: center;">退出</a></dd>
            </dl>
          </li>
        </c:otherwise>
      </c:choose>
    </ul>
  </div>
</div>